var app = getApp();
// socket连接

var util = require('../../utils/util.js');

Page({
  data: {
    type:'',
    token:'',
    url:'',
    bindUrl:''
  },
  // 页面加载
  onLoad: function (options) {
    // 创建连接
    console.log(options)
    this.setData({
      type:options.type
    })

    let that=this
  

    let token1=wx.getStorageSync('token')


  

    wx.request({
      // url: "https://www.cdlpkj.cn/school/a/iim/im/Landing",
      url: util.api+"/iim/im/Landing",
      data: {
        token:token1,
        },
        success: function(res) {
          var tmpsig = res.data;

          console.log("the return of getUserSigByTelephone is:" + tmpsig);
          console.log(res)

          if(!tmpsig.success){

            wx.reLaunch({
              url: '../login/login'
            })

          }else{
            // that.setData({
            //   token: token1,
            //   url:util.api
            // })
            console.log(util.api + '/iim/im/index?token=' + wx.getStorageSync('token') + '&type=' + options.type);
            that.setData({
              bindUrl:util.api+'/iim/im/index?token='+wx.getStorageSync('token')+'&type='+options.type
            })

          }
        },
        fail: function(resp) {
          console.log("getUserSigByTelephone failed,the response is %o", resp)
          return false;
        },
        complete: function(res) {
          // console.log("the return of consultantRegister complete is:" + res.data);
          // console.log(res);
        } //请求完成后执行的函数
      })

  },
  onShow: function (e) {
  },
})


